package com.example.demo.dao;

import com.example.demo.entity.SysBanner;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface SysBannerMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_banner
     *
     * @mbg.generated
     */
    @Delete({
        "delete from sys_banner",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_banner
     *
     * @mbg.generated
     */
    @Insert({
        "insert into sys_banner (`name`, banner_url, ",
        "seq, create_date)",
        "values (#{name,jdbcType=VARCHAR}, #{bannerUrl,jdbcType=VARCHAR}, ",
        "#{seq,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(SysBanner record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_banner
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, `name`, banner_url, seq, create_date",
        "from sys_banner",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="banner_url", property="bannerUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="seq", property="seq", jdbcType=JdbcType.INTEGER),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.TIMESTAMP)
    })
    SysBanner selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_banner
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, `name`, banner_url, seq, create_date",
        "from sys_banner"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="banner_url", property="bannerUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="seq", property="seq", jdbcType=JdbcType.INTEGER),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.TIMESTAMP)
    })
    List<SysBanner> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_banner
     *
     * @mbg.generated
     */
    @Update({
        "update sys_banner",
        "set `name` = #{name,jdbcType=VARCHAR},",
          "banner_url = #{bannerUrl,jdbcType=VARCHAR},",
          "seq = #{seq,jdbcType=INTEGER},",
          "create_date = #{createDate,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysBanner record);
}